#include "ocv.grpc.pb.h"
#include <grpcpp/grpcpp.h>
#include <opencv2/opencv.hpp>

using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;
using ocv::OcvService;
using ocv::VoidRequest;
using ocv::JpegFrameResponse;

class OcvServiceImpl final : public OcvService::Service {
public:
    OcvServiceImpl(const std::string& video_source, int jpeg_quality);
    Status GetFrame(ServerContext* context, const VoidRequest* request, JpegFrameResponse* response) override;
private:
    std::string m_video_device;
    int m_jpeg_quality;
    cv::VideoCapture m_cap;
};